package net.xdclass.exception;

import lombok.Data;
import net.xdclass.enums.BizCodeEnum;

/**
 * 自定义异常处理
 *
 * @author JiangZhou
 * @date 2023/4/27 19:00
 */
@Data
public class BizException extends RuntimeException {

    private int code;

    private String msg;

    public BizException(int code, String msg) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public BizException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMessage());
        this.msg = bizCodeEnum.getMessage();
        this.code = bizCodeEnum.getCode();
    }
}
